export default function MapLoader() {
    return new Promise((resolve, reject) => {
      if (window.AMap) {
        resolve(window.AMap);
      } else {
        const script = document.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.src = 'http://webapi.amap.com/maps?v=1.4.11&callback=initAMap&key=8dbab44eb7fa04fa917f284addd2d01b';
        script.onerror = reject;
        document.head.appendChild(script);
      }
      window.initAMap = () => {
        resolve(window.AMap);
      };
    });
  }
  